﻿using System;
using System.Collections.Generic;
using System.Text;

using Cabal.Kernel.DataSet;
using System.Threading;

namespace Cabal.Kernel.Output
{
    /// <summary>
    /// 任务通知回调代理
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    public delegate bool MissionNoticeCallback(object sender, MissionEventArgs e);

    /// <summary>
    /// 任务回调引用
    /// </summary>
    public class MissionReference
    {
        public MissionReference(MissionNoticeCallback mr) : this(Thread.CurrentThread, mr) { }
        public MissionReference(Thread t, MissionNoticeCallback mr)
        {
            ReferenceThread = t;
            Reference = mr;
        }
        public MissionReference(string name, MissionNoticeCallback mr)
            : this(Thread.CurrentThread, mr)
        {
            Name = name;
        }
        public MissionReference(string name, Thread t, MissionNoticeCallback mr)
            : this(t, mr)
        {
            Name = name;
        }

        //public object Handler;
        public bool SetFlag = false; // i dont know what is it...
        public string Name = "null";
        public System.Threading.Thread ReferenceThread; //设置回调者的县城
        public MissionNoticeCallback Reference; //回调只执行在工作线程上，与设置回调者无关
    }

    /// <summary>
    /// 任务回调事件的参数
    /// </summary>
    public class MissionEventArgs:EventArgs
    {
        public Mission mission;
        public Thread workingThread;
        public string message;
    }

}